<template>
    <div>
        <r-search :searchForm="searchForm" :searchHandle="searchHandle" :searchData="searchData" />
        <r-table :isIndex="true" :isPagination="true" :tableData="tableData" :height="350" :tableCols="tableCols" :tablePage="tablePage" @refresh="init()"></r-table>
    </div>
</template>
<script>
export default {
    props: {
        userid: {
            type: String,
            default: ''
        }
    },
    data() {
        return {
            searchData: {
                number: '',
                deviceType: '',
                agent: '',
                saller: '',
                sType: '2',
            },
            searchForm: [
                {
                    type: 'input',
                    prop: 'number',
                    placeholder: '订单编号',
                    width: 150
                },
                {
                    type: 'date',
                    prop: 'etime',
                    placeholder: '起始时间',
                    width: 180
                },
                {
                    type: 'date',
                    prop: 'updateEtime',
                    placeholder: '结束时间',
                    width: 180
                },
            ],
            searchHandle: [
                {
                    label: '搜索',
                    type: 'success',
                    icon: 'el-icon-search',
                    handle: e => this.init()
                },
                {
                    label: '重置',
                    icon: 'el-icon-refresh-right',
                    handle: e => this.searchFromReset()
                }
            ],
            tableData: [
            ],
            tableCols: [
                {
                    label: '订单编号',
                    prop: 'number',
                    // theme: e => e.status ? 'primary' : 'danger', type: "tag",
                },
                {
                    label: '提现时间',
                    prop: 'createdTime'
                },
                {
                    label: '提现金额',
                    prop: 'money'
                },
                {
                    label: '审核结果',
                    prop: 'state',
                    formatter: e => e.state == 1 ? '审核通过' : e.state == 2 ? '审核不通过' : e.state == 3 ? '待审核' : ''
                },
                {
                    label: '审核时间',
                    prop: 'updatedBy'
                },
                {
                    label: '审核人',
                    prop: 'updatedBy'
                },

            ],
            tablePage: { limit: 10, page: 1, total: 0 },


        };
    },
    components: {},
    computed: {},
    mounted() {
        this.init()
    },
    methods: {
        async init() {
            this.searchData.userId = this.$route.query.id
            let param = { ...this.searchData, ...this.tablePage, userId: this.$route.query.id }
            let res = await this.api.takecashList(param)
            if (res) {
                this.tableData = res.data.list
            }
        },
        elFormSubmit(e) {
            //查询
            console.log(e)
        },
        elFormDetail(row) {
            Object.keys(this.formData).forEach(key => {
                this.formData[key] = row[key]
            })
            this.formData.id = row.id;
            this.formData.cardId = row.cardId
            // if (this.formCols[1].label == '登录密码') {
            //     this.formCols.splice(1, 1)
            // }

            this.elFormVisible()
        },
    }
};
</script>
<style scoped lang='scss'>
.el-icon-search {
  margin-right: 10px;
}
.Tip {
  margin-left: 20px;
}
</style>
